(function($) {
	/*根据电压等级隐藏标签页卡 
	 * start
	 * */
	var volclassArray = [];
	var volClasses_val = $(document.getElementsByName("paramsMap['planitemVolclass'].value")).val();
	var volClasses = volClasses_val.split(",");
	var zhiliu = false;
	var tentwentyunder = false;
	$.each(volClasses,function(index,value){
		if("±500kV" == value || "±800kV" == value){
			if(!zhiliu){
				zhiliu = true;
				volclassArray = volclassArray.insertAt(index,"直流");
			}
		}else if("20kV" == value || "10kV" == value || "0.4kV" == value){
			if(!tentwentyunder){
				tentwentyunder = true;
				volclassArray = volclassArray.insertAt(index,"10（20）kV及以下");
			}
		}else{
			volclassArray = volclassArray.insertAt(index,value);
		}
	})
	var newvolClasses = "";
	$.each(volclassArray,function(index,value){
		newvolClasses += value + ",";
	})
	var labelIndex = newvolClasses.lastIndexOf(",");
	newvolClasses = newvolClasses.substring(0,labelIndex);
	var textPos = 0;
	$("span","div.ui-tabs ul").each(function(index){
		if(newvolClasses.indexOf($(this).text()) == -1){
			$($(this).parents("li").get(0)).remove();
			$("#gridDiv"+$($(this).parents("li").get(0)).attr("id")).remove();
		}else{
			if(index == 0){
				textPos = newvolClasses.indexOf($(this).text());
			}
			if(newvolClasses.indexOf($(this).text()) >= textPos){
				
			}else{
				textPos = newvolClasses.indexOf($(this).text());
			}
		}
	})

	$("span","div.ui-tabs ul").each(function(index){
		if(newvolClasses.indexOf($(this).text()) == textPos){
			changeTab($($(this).parents("li").get(0)).attr("id"),true);
		}
	})	
	/*end*/
})(jQuery);

Array.prototype.insertAt = function(index, value) {
	var part1 = this.slice(0, index);
	var part2 = this.slice(index);
	part1.push(value);
	return (part1.concat(part2));
};

Array.prototype.removeAt = function(index) {
	var part1 = this.slice(0, index);
	var part2 = this.slice(index);
	part1.pop();
	return (part1.concat(part2));
};